/** CODE EVAL::Easy [Hex To Decimal]
 *	Given hexadecimal, convert to decimal
 *
 *	Solution by Michael Pio Arroyo
 */

#include <iostream>
#include <fstream>
#include <string>
#include <stdlib.h>

int HexToDec(std::string a_line);

int main(int argc, char** argv) {
	std::ifstream file;
	std::string line;
	file.open(argv[1]);
	while(getline(file,line)) {
		std::cout << HexToDec(line) << "\n";
	}
	file.close();
	return 0;
}

/**
 *	Convert hexadecimal to decimal
 *	@param a_line...hexadecimal string to convert to decimal
 *	@return int...result
 */
int HexToDec(std::string a_line) {
	int x = 0;
	const char* c;
	c = a_line.c_str();

	x = strtoul(c, NULL, 16);

	return x;
}